package com.yueyang.sojourn.server.model.dto;

import com.yueyang.sojourn.server.model.enums.CardTypeEnum;
import com.yueyang.sojourn.server.validation.annotation.CardNoValid;
import com.yueyang.sojourn.server.validation.annotation.EnumValid;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.GroupSequence;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * 新增游客dto
 * @author andy.yang
 * @summary
 * @Copyright (c) 2020, Yueyang Group All Rights Reserved.
 * @since 2020-03-17 10:45
 */
@Data
@ApiModel("新增游客")
@GroupSequence({AddTouristDto.class,AddTouristDto.CardSqu.class})//类本身放在sequece中代表Default.class
@CardNoValid(groups = {AddTouristDto.CardSqu.class}) //验证联合字段：证件类型及号码
public class AddTouristDto {

    /**
     * 姓名
     */
    @ApiModelProperty(value = "姓名", required = true)
    @NotBlank(message = "[姓名]不能为空")
    @Size(min = 1, max = 10, message = "限制1至10字")
    private String name;

    /**手机号**/
    @ApiModelProperty(value = "手机号")
    @NotNull(message = "[手机号]不能为空")
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "[手机号]格式有误")
    private String mobile;

    /**
     * 证件类型：身份证，驾驶照
     */
    @ApiModelProperty(value = "证件类型: 1 身份证、2 护照、3 港澳通行证、4 台胞证、5 台湾通行证、6 回乡证")
    @NotNull(message = "[证件类型]不能为空")
    @EnumValid(clazz = CardTypeEnum.class)
    private Integer cardType;

    /**
     * 证件号
     */
    @ApiModelProperty(value = "证件号")
    @NotBlank(message = "[证件号]不能为空")
    private String cardNo;


    interface CardSqu{};

}
